<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <!-- 2. 反转字符串

   ```javascript
   var str = 'abcdefg'
   
   // 要求结果
   // gfedcba
   ``` -->
    <script>
        var str = 'abcdefg'
            // 先拆分然后，然后翻转，去逗号
        var res = str.split("").reverse("").join("")
        console.log(res)
    </script>
</body>

</html>